<?php


namespace Crc\Grid;

use Doctrine\ORM\QueryBuilder;

abstract class Operator
{
    protected $_field;
    protected $_name;
    protected $_label;
    protected $_value;
    protected $_selected = false;
    protected $_queryBuilder;

    public function __construct()
    {
        $this->setName();
        $this->setLabel();
    }

    public function setField($field)
    {
        $this->_field = $field;
        return $this;
    }

    public function getField()
    {
        return $this->_field;
    }

    public function setValue($value)
    {
        $this->_value = $value;
        return $this;
    }


    public function getValue()
    {
        return  $this->_value;
    }

   abstract protected function setName();

    public function getName()
    {
        return $this->_name;
    }

    abstract protected function setLabel();

    public function getLabel()
    {
        return $this->_label;
    }

    public function isSelected()
    {
        return $this->_selected;
    }

    public function setSelected($selected = true)
    {
        $this->_selected = $selected;
        return $this;
    }

    abstract public function processOperator(QueryBuilder $queryBuilder);
}